cmake_minimum_required(VERSION 3.5)
project(main_func)

add_compile_options(
  -std=c++11
  -O3
  -g
)

include_directories(
  ${PROJECT_SOURCE_DIR}
  ${EIGEN3_INCLUDE_DIRS}
)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

find_package(absl REQUIRED)

file(GLOB SRC_PERCEPTION_FUSION
  "${PROJECT_SOURCE_DIR}/app/*.cc"
  "${PROJECT_SOURCE_DIR}/base/*.cc"
  "${PROJECT_SOURCE_DIR}/common/*.cc"
  "${PROJECT_SOURCE_DIR}/common/standard_kalman_filter/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/data_association/hm_data_association/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/data_fusion/existence_fusion/dst_existence_fusion/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/data_fusion/motion_fusion/kalman_motion_fusion/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/data_fusion/shape_fusion/pbf_shape_fusion/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/data_fusion/type_fusion/dst_type_fusion/dst_type_fusion.cc"
  "${PROJECT_SOURCE_DIR}/lib/data_fusion/tracker/pbf_tracker/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/gatekeeper/pbf_gatekeeper/proto/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/gatekeeper/pbf_gatekeeper/*.cc"
  "${PROJECT_SOURCE_DIR}/lib/fusion_system/probabilistic_fusion/*.cc"
  # "${PROJECT_SOURCE_DIR}/lib/fusion_system/probabilistic_fusion/probabilistic_fusion_test.cc"
)

add_library(${FUSION_LIB_NAME_PREFIX}_${PROJECT_NAME} SHARED ${SRC_PERCEPTION_FUSION})

target_include_directories(${FUSION_LIB_NAME_PREFIX}_${PROJECT_NAME}
	PUBLIC
  ${EIGEN3_INCLUDE_DIRS}
  ${FUSION_INCLUDE_DIRS}
)
message("FUSION_LINKER_LIBS" << ${PROJECT_NAME} << ${FUSION_LINKER_LIBS})

target_link_libraries(${FUSION_LIB_NAME_PREFIX}_${PROJECT_NAME}
  PUBLIC
  ${FUSION_LINKER_LIBS}
  glog
  yaml-cpp
  gflags
  ${abseil_cpp_LIBRARIES}
)

list(APPEND FUSION_LINKER_LIBS ${FUSION_LIB_NAME_PREFIX}_${PROJECT_NAME})
set(FUSION_LINKER_LIBS ${FUSION_LINKER_LIBS} PARENT_SCOPE)
